feat(channels): add xiaoyi channel support#875
feat(channels): add xiaoyi channel support#875ystyle wants to merge 2 commits intosipeed:refactor/channel-systemfrom
Conversation
a4c458f to
fd8e4cd
Compare
There was a problem hiding this comment.
Why are there changes to the Dockerfile regarding the channel modifications?
There was a problem hiding this comment.
Already resolved, it was a mistaken submission
b974a00 to
ae50335
Compare
|
Hi @alexhoshina, thank you for the review!
```go My implementation follows the same pattern as the `telegram` channel. I've also tested it locally - sending a message to XiaoYi and getting a response works correctly. Could you please double-check? Thanks! |
README.md
Outdated
| ## 💬 Chat Apps | ||
|
|
||
| Talk to your picoclaw through Telegram, Discord, WhatsApp, DingTalk, LINE, or WeCom | ||
| Talk to your picoclaw through Telegram, Discord, DingTalk, LINE, WeCom, or XiaoYi |
There was a problem hiding this comment.
Why was WhatsApp deleted?
pkg/channels/xiaoyi/xiaoyi.go
Outdated
| return nil | ||
| } | ||
|
|
||
| chatID := fmt.Sprintf("%s:%s", sessionID, taskID) |
There was a problem hiding this comment.
Potential impact on sessionID parsing needs to be analyzed, introducing new considerations: whether it will affect the parsing of sessionID
| return fmt.Errorf("xiaoyi reply: %w", channels.ErrTemporary) | ||
| } | ||
|
|
||
| if err := c.client.SendStatus(ctx, taskID, sessionID, "Completed", "completed"); err != nil { |
There was a problem hiding this comment.
Will the completed status published here conflict with long message fragmentation?
|
Also, regarding the SDK you are using, perhaps it should also use a license compatible with Pico. |
You are correct, I was referring to the old function signature, my apologies. |
|
@alexhoshina Thanks for the feedback!
|
|
@alexhoshina Good point about message fragmentation! Currently, XiaoYi channel doesn't implement However, if we need to support For now, the implementation works correctly without fragmentation. Should I:
What do you suggest? |
WhatsApp has been removed in RADEME, you can check the line numbers I've marked, but it's just a minor issue |
Is xiaoyi need this chatID format? |
- Add XiaoYiChannel in pkg/channels/xiaoyi/ subpackage - Implement A2A protocol using xiaoyi-agent-sdk - Use ReplyStream + SendStatus for long-task pattern - Add XiaoYiConfig to config.go - Register xiaoyi in manager.go initChannels - Add blank import in gateway helpers - Add documentation in docs/channels/xiaoyi/ - Update README.md and README.zh.md channel lists
ae50335 to
693db82
Compare
|
@alexhoshina Sorry for the confusion! You were right about WhatsApp. I found the issue - when I added XiaoYi to the README.md description line, I accidentally replaced "WhatsApp" instead of appending "XiaoYi". This has been fixed in the latest commit (693db82):
Thank you for catching this! 🙏 |
|
@yinwm Yes, the
The Alternative approaches:
But the current |
nikolasdehor
left a comment
There was a problem hiding this comment.
Well-structured channel implementation that follows existing patterns. The author has been responsive to feedback. Additional observations: (1) SDK license: As alexhoshina noted, the xiaoyi-agent-sdk dependency needs a compatible license (picoclaw uses Apache-2.0). The SDK repo should have an explicit license file before this PR merges. (2) chatID separator robustness: The sessionID:taskID format parsed with SplitN(msg.ChatID, ":", 2) works only if sessionID never contains ':'. Consider using a different separator or storing taskID in metadata. (3) Context usage: c.HandleMessage(c.ctx, ...) uses the channel-level context rather than the per-message ctx. If the channel is stopped mid-processing, this could cancel in-flight messages prematurely. (4) Error wrapping: In Send, the error is wrapped as channels.ErrTemporary regardless of the actual error type. Some errors (invalid session) may be permanent. Good work overall — pending license resolution.
Note that pico uses the MIT license |
- Change chatID separator from ':' to '|' for robustness - Use per-message ctx instead of channel-level c.ctx in HandleMessage - Distinguish error types: ErrSessionNotFound -> ErrSendFailed (permanent) - Update xiaoyi-agent-sdk dependency
|
@alexhoshina @nikolasdehor Thank you for the detailed review! I've addressed all the feedback in commit b3ff44f:
Please let me know if there are any other issues to address. Thanks! |
|
Given that the SDK you are using is a one man show, we would have concern over the supply chain security(I know go has checksums etc). I would be very cautious to move forward. |
|
@xiaket Thank you for raising the supply chain security concern. That's a valid point. The xiaoyi-agent-sdk is developed following Huawei's official TypeScript SDK: https://developer.huawei.com/consumer/cn/doc/service/openclaw-0000002518410344 The official installation method is: Our Go SDK implements the same A2A protocol as the official TS SDK. I understand the concern about a single-maintainer dependency. A few options to address this:
What would you suggest as the best approach to move forward? |
|
From my personal perspective, I don't think it's fair to ask sipeed/picoclaw to support an SDK that has very little usage. |
|
@xiaket You're right about the current usage. However, Huawei's OpenClaw agent type was just released about two weeks ago. The ecosystem is still very new. As the first (and currently only) Go SDK for OpenClaw, usage will naturally grow as more developers adopt the platform. This PR would enable picoclaw users to connect to Huawei's XiaoYi ecosystem early. But I completely understand the concern. Let's wait for @Zepan's input on how to proceed. Options remain:
Thank you for the thoughtful review! 🙏 |
Summary
pkg/channels/xiaoyi/subpackage following new channel architectureBaseChannelwith factory registration patternXiaoYiConfigto config.goFiles Changed
pkg/channels/xiaoyi/init.go- Factory registrationpkg/channels/xiaoyi/xiaoyi.go- Channel implementationpkg/config/config.go- Add XiaoYiConfigpkg/channels/manager.go- Register xiaoyi in initChannelscmd/picoclaw/internal/gateway/helpers.go- Blank importdocs/channels/xiaoyi/- Documentation (zh/en)README.md/README.zh.md- Update channel listgo.mod/go.sum- Add SDK dependencyConfiguration
{ "channels": { "xiaoyi": { "enabled": true, "ak": "your-access-key", "sk": "your-secret-key", "agent_id": "your-agent-id" } } }Related